import request from '@/utils/request'

const baseURL = '/api/major'

export function getMajorList({
                              page, pageSize, params = {}, data
                            }) {
  return request({
    url: baseURL + '/list',
    method: 'post',
    params: {
      page, pageSize,
      ...params
    }, data
  })
}

export function getOneMajor(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'get'
  })
}

export function addMajor(data) {
  return request({
    url: baseURL,
    method: 'post',
    data
  })
}

export function updateMajor(id, data) {
  return request({
    url: baseURL + `/${id}`,
    method: 'put',
    data
  })
}

export function deleteOneMajor(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'delete'
  })
}
